<template>
  <div class="list-table noPad">
    <el-tabs v-model="activeName" @tab-click="tabClick">
      <el-tab-pane :label="$t('会议信息')" name="first">
        <mtBusinessList v-if="refresh" v-show="isShow" ref="mtBusinessList" :business-detail-id-list="businessDetailIds" @resetDetailList="resetDetailList" />
      </el-tab-pane>
      <el-tab-pane :label="$t('推送记录')" name="second">
        <mtBusinessDetailList v-show="!isShow" ref="mtBusinessDetailList" @push="push" @getBusinessDetailIds="getBusinessDetailIds" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
  import mtBusinessList from '@/views/oa/business/mtBusinessList'
  import mtBusinessDetailList from '@/views/oa/business/mtBusinessDetailList'
    export default {
      components: {
        mtBusinessList,
        mtBusinessDetailList
      },
      data() {
        return {
          activeName: 'first',
          // 推送记录复选框选中的上会项目id
          businessDetailIds: [],
          isShow: true,
          refresh: true
        }
      },
      methods: {
        tabClick(tab) {
          this.isShow = tab.name === 'first'
        },
        push() {
          // this.refresh = false
          this.refresh = true
          this.isShow = true
          this.activeName = 'first'
          this.$refs.mtBusinessList.addHandle()
        },
        getBusinessDetailIds(val) {
          this.businessDetailIds = []
          val.forEach((e) => {
            this.businessDetailIds.push(e.id)
          })
        },
        resetDetailList() {
          this.$refs.mtBusinessDetailList.resetQuery()
        }
      }
    }
</script>

<style scoped>

</style>
